package 笔试.贝壳;

import java.util.Arrays;
import java.util.Scanner;

public class Demo33 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(); //物品和机会数
        int k = sc.nextInt(); //k次作废
        int m = sc.nextInt(); //阈值m
        int[] w = new int[n];
        for (int i = 0; i < n; i++) {
            w[i] = sc.nextInt();
        }
        Arrays.sort(w);
        int max = 0;
        //前缀和
        int[] sum = new int[n+1];
        for (int i = 1; i <= n ; i++) {
            sum[i] = sum[i-1]+w[i-1];
        }
        int deNum = 0;
        int inNum = 0;
        int index = 0;
        for (int i = 0; i < n; i++) {
            if(w[i]>m){
                index = i;
                break;
            }
        }
        inNum = n-index+1; //大于m的数量
        deNum = n-inNum; //小于或等于m的数量
        int a = n/(k+1);
        int b = n%(k+1);
//        if(w[n-1]<=m){
//           max = sum;
//        }
        max += sum[n]-sum[n-a];

        System.out.println(max);

    }
}
